<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>computed属性的读写操作</title>
    <script src="../vue.js"></script>
</head>
<body>
    <div id="box">
        今天的日期是:{{computedDate}}
    </div>
    
</body>
<script>
    let obj = {
        data(){
            return {
                year:'2015',
                month:'12',
                day:31,
            }
        },
        computed:{
            computedDate:{
                get(){
                    return this.year+'-'+this.month+'-'+this.day
                },
                set(value){
                    return [this.year,this.month,this.day] = value.split('-');
                }
            }
        }
    }
    let app = Vue.createApp(obj).mount('#box');
</script>
</html>